class Bg {

    public icon:egret.Bitmap;
    private panel:egret.DisplayObjectContainer;

    public constructor(panel: egret.DisplayObjectContainer,url:string) {
        this.icon = this.createBitmapByName(url);
        panel.addChild(this.icon);
        let stageW: number = panel.stage.stageWidth;
        let stageH: number = panel.stage.stageHeight;
        this.icon.width = stageW;
        this.icon.height = stageH;
        this.panel = panel;

    }
    private createBitmapByName(name: string): egret.Bitmap {
        let result = new egret.Bitmap();
        let texture: egret.Texture = RES.getRes(name);
        result.texture = texture;
        return result;

    }
    public setIcon(w:number,h:number,z:number){
        this.icon.width = w*2;
        this.icon.height = h*2;
        this.icon.anchorOffsetX = this.icon.width/2;
        this.icon.anchorOffsetY = this.icon.height/2;
        this.icon.x = this.panel.width/2;
        this.icon.y = this.panel.height/2;
        this.panel.setChildIndex(this.icon,z);
    }


    
}